<template>
  <el-dialog :title="title" :visible="state" @close="closeDialog1">
    <el-form :model="myfrom">
      <el-form-item label="餐桌名字" :label-width="formLabelWidth">
        <el-input
          v-model="myfrom.food_table_number"
          autocomplete="off"
          name="food_table_number"
        ></el-input>
      </el-form-item>
      <el-form-item label="座位数" :label-width="formLabelWidth">
        <el-input
          v-model="myfrom.food_table_seat"
          autocomplete="off"
          name="food_table_seat"
        ></el-input>
      </el-form-item>
      <el-form-item label="预定时间" :label-width="formLabelWidth">
        <el-input
          v-model="myfrom.food_table_usingTime"
          autocomplete="off"
          name="food_table_usingTime"
        ></el-input>
      </el-form-item>

      <el-form-item label="餐桌类型" :label-width="formLabelWidth">
        <el-select
          v-model="myfrom.food_table_type"
          placeholder="请选择餐桌类型"
        >
          <el-option label="大厅" value="大厅"></el-option>
          <el-option label="包间" value="包间"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="就餐人数" :label-width="formLabelWidth">
        <el-input
          v-model="myfrom.food_table_peoples"
          autocomplete="off"
          name="food_table_peoples"
        ></el-input>
      </el-form-item>
      <el-form-item label="结账状态" :label-width="formLabelWidth">
        <el-select
          v-model="myfrom.food_table_account"
          placeholder="请选择结账状态"
        >
          <el-option label="未结账" value="0"></el-option>
          <el-option label="已结账" value="1"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="使用状态" :label-width="formLabelWidth">
        <el-select
          v-model="myfrom.food_table_action"
          placeholder="请选择餐桌使用状态"
        >
          <el-option label="未使用" value="0"></el-option>
          <el-option label="已使用" value="1"></el-option>
        </el-select>
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="quxiao1">取 消</el-button>
      <el-button type="primary" @click="mysubmit1">确 定</el-button>
    </div>
  </el-dialog>
</template>

<script>
import * as api from '../utils/api'

export default {
  name: 'Adddialog',
  props: ['state', 'myfrom', 'title'],
  data() {
    return {

    }
  },
  computed: {
  },
  data() {
    return {
      formLabelWidth: '120px'
    }
  },
  methods: {
    /* 取消 */
    quxiao1() {
      this.$emit('noAdd')
    },
    /* 提交 */
    mysubmit1() {
      this.$emit('noAdd');

      /* 赋值 */
      console.log(this.myfrom);
      this.axios({
        method: 'post',
        url: api.ADD_TABLE,
        data: this.myfrom,

      }).then(data => {
        console.log(data);
        if (data.data.code == 200) {
          this.myfrom.food_table_number = ''
          this.myfrom.food_table_action = ''
          this.myfrom.food_table_seat = ''
          this.myfrom.food_table_usingTime = ''
          this.myfrom.food_table_type = ''
          this.myfrom.food_table_peoples = ''
          this.myfrom.food_table_account = ''
          this.$emit('shuaxin')
        }
      })
    },
    /* 关闭 */
    closeDialog1() {
      this.$emit('noAdd')
    }
  }



};
</script>

<style>
</style>